<template>
  <el-row>
    <el-button type="primary" @click="index">访问首页</el-button>
    <el-button type="success" @click="add">添加用户</el-button>
    <el-button type="info" @click="update">修改用户</el-button>
    <el-button type="warning" @click="find">查询用户</el-button>
    <el-button type="danger" @click="del">删除用户</el-button>
  </el-row>
</template>

<script>
export default {
  name: "permission",
  
  methods: {
    index() {
      this.$axios.post("/user/home").then((res) => {
        this.$message({
          type: res.data.success ? "success" : "error",
          message: res.data.message,
        });
      });
    },
    add() {
      this.$axios.post("/user").then((res) => {
        this.$message({
          type: res.data.success ? "success" : "error",
          message: res.data.message,
        });
      });
    },
    update() {
      this.$axios.put("/user").then((res) => {
        this.$message({
          type: res.data.success ? "success" : "error",
          message: res.data.message,
        });
      });
    },
    find() {
      this.$axios.get("/user").then((res) => {
        this.$message({
          type: res.data.success ? "success" : "error",
          message: res.data.message,
        });
      });
    },
    del() {
      this.$axios.delete("/user").then((res) => {
        this.$message({
          type: res.data.success ? "success" : "error",
          message: res.data.message,
        });
      });
    },
  },
};
</script>

<style>
</style>